package demo2;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-04-06
 * Time: 16:27
 */
public class Test {
    /*
    删除第一个字符串中出现的第二个字符串当中的字符
    str1: welcome to bit
    str2: come
    最后得到：wl t bit    利用集合完成
     */

    public static void func(String str1, String str2){

        List<Character> ret = new ArrayList<>();
        for (int i = 0; i < str1.length() ; i++) {
            char ch = str1.charAt(i);
            if(!str2.contains(ch + "")){
                ret.add(ch);
            }
        }
        for (Character x :ret) {
            System.out.print(x);
        }
    }


    public static void main(String[] args) {
        func("welcome to bit","come");

    }
}
